
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * 登录面板
 */
public class LoginPanel extends JPanel implements ActionListener {
    private JButton loginBtn;
    private JButton register;
    private Atmtest frame;
    public LoginPanel(Atmtest frame){
        this.frame = frame;
        this.setLayout(null);

        loginBtn = new JButton(Util.getIcon("/img/buttonLand.jpg"));
        loginBtn.setBounds(900,200,100,50);
        this.add(loginBtn);
        loginBtn.addActionListener(this);

        register = new JButton(Util.getIcon("/img/buttonLogin.jpg"));
        register.setBounds(900,270,100,50);
        this.add(register);
        register.addActionListener(this);
        this.setOpaque(false);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if(e.getSource() == loginBtn){
            frame.switchPanel("menu");
        }
        if(e.getSource() == register){
            frame.switchPanel("logon");
        }
    }
}
